home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_u_z / ww0335.zip / WW0335T.TXT
Text File  |  1990-08-24  |  73KB  |  1,434 lines

  1. ======================================================================
  2.                              INTRODUCTION
  3. ======================================================================
  4.                    A new angle on memory management
  5.  
  6. Version 3.00 of Microsoft Windows brings a new angle to PC memory
  7. management. It provides a protected mode graphical operating
  8. environment that runs existing DOS applications and allows Windows
  9. applications to break the 640K barrier. Windows 3.00 memory management
  10. is simpler in many ways than that of previous versions. However, its
  11. flexibility continues to present a challenge to those who want to
  12. understand its operation in depth. This document examines the three
  13. types of memory that Windows 3.00 can use (conventional, extended, and
  14. expanded) and discusses how the three modes of Windows 3.00 (real,
  15. standard, and enhanced) operate and use memory.
  16.  
  17.  
  18. ======================================================================
  19.                              MEMORY TYPES
  20. ======================================================================
  21.  
  22. There are three different kinds of memory that can be installed in
  23. your machine. These are conventional, extended, and expanded. In
  24. addition, IBM PC-compatible machines contain a 384K reserved I/O
  25. address space.
  26.  
  27. CONVENTIONAL MEMORY
  28. ===================
  29.  
  30. Conventional memory is the first 640K of memory in your machine (see
  31. Figure 1). DOS has a limit of 640K of addressable memory, and all DOS
  32. applications have to run within this conventional memory. All of the
  33. Windows 3.00 operating modes share this limitation for running DOS
  34. applications, but standard and enhanced modes break the 640K
  35. limitation for running Windows applications. Windows 3.00 enhanced
  36. mode can create multiple virtual DOS machines (for more information on
  37. virtual DOS machines, see the "Enhanced Mode and Conventional Memory"
  38. section of this application note).
  39.  
  40.    NOTE: Enhanced mode Windows 3.00 also allows DOS applications to
  41.    break the 640K barrier if they are written to use the Microsoft DOS
  42.    Protected Mode Interface (DPMI) specification. DPMI allows DOS
  43.    applications to run in protected mode under Windows 3.00, using up
  44.    to 16 megabytes of extended memory directly. Applications must be
  45.    specifically written for DPMI to provide this feature.
  46.  
  47.           **************************************************
  48.               Figure 1: Conventional and Extended Memory
  49.           
  50.             Graphic not available in text-formatted file.
  51.               Please see printed document for Figure 1.
  52.           **************************************************
  53.  
  54.  
  55. 384K RESERVED I/O ADDRESS SPACE
  56. ===============================
  57.  
  58. Between the top of conventional memory at 640K and the start of
  59. extended memory at 1024K lies the 384K reserved I/O address space (see
  60. Figure 2). This area does not contain physical memory. Mapped into the
  61. 384K reserved I/O address space are the BIOS (basic input/output
  62. system) ROM chips and the display adapter memory. When you install
  63. other accessory cards, such as network adapters, they occupy space
  64. within the 384K reserved I/O address space as well. It is important to
  65. remember that the 384K reserved I/O address area is always located in
  66. the same area of the IBM PC-compatible computer's address space: from
  67. 640K to 1024K (A000 to FFFF hexadecimal). There are no exceptions to
  68. this rule.
  69.  
  70. This means that a standard IBM-compatible machine with 640K of
  71. conventional memory installed really has 1 megabyte of address space.
  72. The system memory occupies the first 640K, and the 384K reserved I/O
  73. address space occupies the area from 640K to 1 megabyte. This does not
  74. mean that the machine has 1 megabyte of memory. A machine with 1
  75. megabyte of physical memory has an address space of 1408K. This
  76. consists of the 640K conventional memory, the 384K reserved I/O
  77. address space, and the 384K of extended memory starting at 1024K. The
  78. IBM PS/2 Models 50, 50Z, and 60 are examples of machines that always
  79. ship with at least 1 megabyte of memory installed.
  80.  
  81. EXTENDED MEMORY
  82. ===============
  83.  
  84. Extended memory is the simplest type of add-on memory to understand
  85. (see Figure 1). It is also the type of memory used by Windows 3.00
  86. running in standard or enhanced operating mode. Extended memory is
  87. simply a seamless continuation of the original 1 megabyte address
  88. space on 80286 and 80386 computers. Extended memory always starts
  89. exactly at 1024K, where the 384K reserved I/O address space ends.
  90. There are no exceptions.
  91.  
  92. It is not possible for an 8086 or 8088 machine to have extended
  93. memory. This is a hardware limitation of the 8086/8088 processors,
  94. which can handle only 1024K of total address space (that is, 640K
  95. system memory plus 384K reserved I/O address space). The 80286
  96. processor can address 16 megabytes of total memory and the 80386
  97. processor can address up to 4 gigabytes. Note that PC manufacturers
  98. often refer to extended memory as expansion memory, which is not to be
  99. confused with expanded memory.
  100.  
  101. Windows 3.00 and all applications running under Windows access
  102. extended memory via the Microsoft eXtended Memory Specification (XMS).
  103. Rather than accessing extended memory directly, access is made via an
  104. XMS driver. This driver is called HIMEM.SYS. Older DOS applications
  105. that check available extended memory via the interrupt 15 service 88H
  106. will not see any extended memory with an XMS driver loaded. These
  107. applications must use the XMS, instead of interrupt 15, to access
  108. extended memory.
  109.  
  110. EXPANDED MEMORY
  111. ===============
  112.  
  113. Older versions of Windows use mostly expanded memory. Today, Windows
  114. 3.00 uses expanded memory only when running in real mode. However, it
  115. is important to understand the concept of expanded memory if you still
  116. run DOS applications that use it. There are two different kinds of
  117. expanded memory, differentiated by their Lotus/Intel/Microsoft (LIM)
  118. Expanded Memory Specification (EMS) version number.
  119.  
  120. LIM 3.2 Expanded Memory
  121. -----------------------
  122.  
  123. We discussed earlier that the old PC/XT machines with 8086/8088
  124. processors can address only 640K of memory. You can't add more than
  125. 640K of standard memory to the system, but you can provide more than
  126. 640K through a technique called bank switching. Expanded memory uses
  127. an empty area in the 384K reserved I/O address space of the machine to
  128. provide this functionality.
  129.  
  130. Figure 3 shows the memory addressing range of an 8088-family processor
  131. on the left and an expanded memory card on the right. To use an
  132. expanded memory card, you must load a device driver to let the card
  133. know how to communicate with the PC. This device driver is called an
  134. Expanded Memory Manager, or EMM. The LIM 3.2 EMM establishes a 64K
  135. page frame within the 384K reserved I/O address space to perform EMS
  136. bank switching. The 64K page frame consists of four 16K contiguous
  137. pages. LIM 3.2 expanded memory won't work without a 64K contiguous
  138. page frame.
  139.  
  140. The page frame is the area where the expanded memory manager maps
  141. information into and out of the RAM of the expanded memory card.
  142. Information is not physically copied from the EMS card to the RAM of
  143. the computer. The device driver simply changes the card's page
  144. registers to make the page frame point to the data on the expanded
  145. memory card. The data then appears in the page frame, and your
  146. application can access it.
  147.  
  148.           **************************************************
  149.             Figure 2: The 384K Reserved I/O Address Space
  150.                                         
  151.           (Use this page for reference when troubleshooting
  152.                       memory address conflicts.)
  153.                                         
  154.             Graphic not available in text-formatted file.
  155.               Please see printed document for Figure 2.
  156.           **************************************************
  157.                                         
  158.                                         
  159.           **************************************************
  160.                   Figure 3: LIM 3.2 Expanded Memory
  161.           
  162.             Graphic not available in text-formatted file.
  163.               Please see printed document for Figure 3.
  164.           **************************************************
  165.  
  166.  
  167. LIM 4.0 Expanded Memory
  168. -----------------------
  169.  
  170. The LIM 3.2 standard is fine for storing data such as spreadsheets in
  171. expanded memory, but it does not help for multitasking. This is why
  172. Lotus, Intel, and Microsoft created the LIM 4.0 standard.
  173.  
  174. Comparing Figures 3 and 4 shows two of the major differences between
  175. LIM 3.2 and 4.0. First, you can have more than four 16K pages, much
  176. more. LIM 4.0 supports up to 64 pages, which are enough to bank 1
  177. megabyte of memory at once. Second, the page frame itself no longer
  178. has to be four contiguous 16K pages. In fact, you need no page frame
  179. at all. Whichever EMS version you are dealing with, the basic
  180. operating principle of bank switching is still at work.
  181.  
  182. Backfilling
  183. -----------
  184.  
  185. With LIM 4.0's limit of 64 16K pages, you have enough pages to bank
  186. switch the entire conventional address range of the processor. Yet
  187. there must be no active ROM or RAM of any sort where you put an
  188. expanded memory page. This means you can't map EMS pages on top of
  189. anything that is already occupying address space in your machine (such
  190. as loaded DOS or video/system ROM). On the 80286 processor, this means
  191. you should disable as much motherboard memory as possible (down to
  192. 256K) and let the expanded memory card supply that memory. This
  193. process is called backfilling. This doesn't mean that your computer
  194. will have only 256K -- your programs still see a 640K machine. But
  195. since the expanded memory card is now supplying the memory, it can
  196. bank switch the memory. This capability is called (erroneously) "large
  197. page frame."
  198.  
  199. The 80386 processor has a built-in ability to readdress any page of
  200. memory to any other location. This means you don't have to backfill on
  201. an 80386 to get large page frame LIM 4.0 functionality, nor do you
  202. need an expanded memory board. It's easy to convert your 80386's
  203. extended memory to expanded with an 80386 Expanded Memory Manager such
  204. as Microsoft EMM386.SYS.
  205.  
  206. If you're using an expanded memory board on an 80386 machine, read
  207. your manual carefully before you backfill. Not all memory boards have
  208. the register support to supply more than four 16K pages (LIM 3.2).
  209. Though a memory driver may conform to the LIM 4.0 specification, that
  210. does not mean the hardware can provide more than four pages. Also,
  211. since Windows 3.00 supports extended memory directly, backfilling
  212. expanded memory will not give you any advantages unless you plan to
  213. run only real mode Windows.
  214.  
  215.           **************************************************
  216.                   Figure 4: LIM 4.0 Expanded Memory
  217.           
  218.             Graphic not available in text-formatted file.
  219.               Please see printed document for Figure 4.
  220.           **************************************************
  221.  
  222.  
  223. LIMulators
  224. ----------
  225.  
  226. There are some programs available that emulate expanded memory using
  227. extended memory and/or hard disk space. These programs are sometimes
  228. known as LIMulators. They are not much of an advantage because
  229. although they supply expanded memory, they are not hardware. They must
  230. place a 64K EMS page frame in conventional memory and also take up
  231. space for the driver itself. LIMulators generally take upward of 80K
  232. conventional memory to run. Since conventional memory is the most
  233. precious memory on your machine, we do not recommend these types of
  234. programs. They are also extremely slow.
  235.  
  236. Expanded Memory Difficulties
  237. ----------------------------
  238.  
  239. Expanded memory requires a page frame to work, and the page frame is
  240. located within the 384K reserved I/O address space of your machine.
  241. Unfortunately, your EMM is not the only competitor for that memory
  242. space. Add-on boards such as network cards, 3270 emulation cards, ESDI
  243. disk controllers, and others can contend for this address space.
  244. Several potential difficulties can arise due to this contention:
  245.  
  246. 1. Lack of Space
  247.  
  248.    The major problem is simply finding at least 64K of contiguous free
  249.    space in which to place the page frame. LIM 4.0 does not require a
  250.    64K page frame but is almost useless without it. Frequently the
  251.    address areas of various adapter cards need to be shuffled about to
  252.    open a contiguous 64K page frame. Complicating this process are
  253.    such boards as the IBM 3270, which have nonmovable addresses in
  254.    most machines.
  255.  
  256. 2. Mapping Conflicts
  257.  
  258.    Most EMMs (such as EMM386.SYS and Windows 3.00 enhanced mode) use a
  259.    search algorithm to find unused memory between C000 and DFFF
  260.    located in the 384K reserved I/O address space to use as page
  261.    frames. Some cards (adapters) do not reserve their address space
  262.    until you access the card, so the memory manager can inadvertently
  263.    map EMS pages on top of an address the card will request. This can
  264.    cause hanging and intermittent operation. This problem is fairly
  265.    rare because the page search routine can locate almost all popular
  266.    adapters.
  267.    
  268.    In case of problems, the first thing to do is to disable expanded
  269.    memory. This will show if a page conflict really is causing the
  270.    symptom you are experiencing. If the problem goes away without
  271.    expanded memory, the memory manager must be told to exclude the
  272.    address the adapter is occupying from consideration as a page
  273.    location. The adapter also may have to be moved. You do this
  274.    different ways with different memory managers. Consult your memory
  275.    manager's documentation for information on how to exclude an
  276.    address range.
  277.    
  278.  
  279. ======================================================================
  280.                  WINDOWS 3.00 MODES AND MEMORY USAGE
  281. ======================================================================
  282.                       How it works in each mode
  283.  
  284. This section examines how the three different modes of Windows 3.00
  285. (real, standard, and enhanced) use the different types of memory we
  286. have discussed (conventional memory, the 384K reserved I/O address
  287. space, extended memory, and expanded memory).
  288.  
  289. REAL MODE WINDOWS 3.00
  290. ======================
  291.  
  292. Real Mode and Conventional Memory
  293. ---------------------------------
  294.  
  295. Windows 3.00 in real mode is similar in most respects to Windows/286
  296. versions 2.x. Real mode Windows 3.00 executes entirely within
  297. conventional memory. It requires 384K of free conventional memory
  298. (393,216 bytes reported by CHKDSK) to start up successfully.
  299.  
  300. Real Mode and the 384K Reserved I/O Address Space
  301. -------------------------------------------------
  302.  
  303. Windows 3.00 does not access the 384K reserved I/O address space
  304. directly in real mode. Remember though, if an external EMM is present
  305. (such as EMM386.SYS), the EMM will use areas of the 384K reserved I/O
  306. address space.
  307.  
  308.    NOTE: Windows 3.00 real mode operation is similar in most respects
  309.    to Windows/286 versions 2.x. Real mode can use most Windows 2.x
  310.    device drivers and runs applications written for Windows 2.x.
  311.  
  312. Real Mode and Expanded Memory
  313. -----------------------------
  314.  
  315.    SMALL VERSUS LARGE PAGE FRAME MODE
  316.    
  317.    Real mode Windows 3.00 will automatically switch into large page
  318.    frame mode when 280K (plus or minus 8K) of free, mappable expanded
  319.    memory pages in conventional memory are available after all Windows
  320.    code has been loaded. The ending position of Windows code in memory
  321.    plus the amount of Windows global memory determine the start of
  322.    free expanded memory pages. Global memory is a memory segment that
  323.    Windows puts aside to store things that need to be globally
  324.    available to all applications, such as printer drivers and fonts.
  325.    The point at which the free mappable expanded memory pages begin is
  326.    called the EMS line.
  327.    
  328.    ADJUSTING THE EMS LINE
  329.    
  330.    There is no way to set the position of the EMS line explicitly,
  331.    because real mode Windows sets it automatically, as discussed
  332.    above. However, you can adjust the EMS line position in a manner
  333.    relative to its current position with the command line parameters
  334.    discussed below.
  335.    
  336.    REAL MODE WINDOWS EXPANDED MEMORY COMMAND-LINE PARAMETERS
  337.    
  338.    The /N Switch
  339.    
  340.    Starting real mode Windows with the /N command-line switch disables
  341.    real mode Windows' use of expanded memory for banking of Windows
  342.    applications. This effectively eliminates an EMS line.
  343.    
  344.    The /N switch does not disable expanded memory but only real mode
  345.    Windows' use of it. Your external EMM will still be present. A page
  346.    frame will be established, and applications can still use LIM 3.2
  347.    (if a 64K contiguous page frame is present). This means that this
  348.    switch is not useful for debugging possible expanded memory page
  349.    frame conflicts. The /N switch disables only real mode Windows' use
  350.    of expanded memory, not the expanded memory itself. To disable the
  351.    expanded memory itself, you must remove the external EMM.
  352.    
  353.    The /L Switch
  354.    
  355.    Starting real mode Windows with the /L+nnn parameter moves the EMS
  356.    line up or down the specified amount of kilobytes (rounded to 16K
  357.    increments). The command line WIN/L+16 moves the EMS up 16K,
  358.    possibly fine-tuning Windows with your system, provided you are
  359.    already in large page frame. Do not use the /L-16 parameter to move
  360.    the EMS down, as it will infringe on global memory and cause
  361.    problems with printing or displaying fonts.
  362.    
  363.    Real mode Windows normally starts in large page frame. Start real
  364.    mode Windows with WIN /L+200 (where 200 is simply an arbitrarily
  365.    large number) to force real mode Windows to small page frame mode.
  366.    There is almost never a practical use for any other positive
  367.    parameter.
  368.    
  369.    The /E Switch
  370.    
  371.    The /Ennn parameter gives you the ability to adjust the 280K
  372.    default point at which real mode Windows will go into large page
  373.    frame mode (see above). Keep in mind that real mode Windows does
  374.    not automatically use one mode or the other without a good reason.
  375.    Explicitly setting small or large page frame mode, as opposed to
  376.    Windows' automatic choice, may cause problems. Windows' automatic
  377.    choice is usually the best choice to take.
  378.    
  379.    However, if you want to explicitly set one mode or the other, you
  380.    can use this switch. For example, starting real mode Windows with
  381.    WIN /E100 causes Windows to go into large page frame mode if only
  382.    100K of bankable conventional EMS pages are free after Windows code
  383.    initialization (this effectively switches real mode Windows to
  384.    large page frame mode). Conversely, starting real mode Windows with
  385.    WIN /E600 forces small page frame mode in all circumstances. You
  386.    should normally use the /L+200 switch for this purpose.
  387.  
  388. Real Mode and Extended Memory
  389. -----------------------------
  390.  
  391.    CODE CACHING USING EXTENDED MEMORY
  392.    
  393.    Real mode Windows 3.00 does not access extended memory directly.
  394.    However, if extended memory is present and HIMEM.SYS is loaded,
  395.    real mode Windows can speed its operation considerably by
  396.    performing code caching to extended memory.
  397.    
  398.    All Windows applications are segmented, that is, divided into
  399.    segments that have certain attributes. These attributes include
  400.    movable attributes, which means that the segment can be moved
  401.    around in memory, and discardable attributes, which means that the
  402.    segment can be discarded (that is, forgotten about, overwritten,
  403.    and reloaded from disk when necessary). The largest portion of a
  404.    given Windows application has both the movable and discardable
  405.    attributes.
  406.    
  407.    Under real mode Windows, a lot of discarding goes on because real
  408.    mode is limited to conventional memory. Windows applications are
  409.    frequently 600K or larger, much larger than available free memory
  410.    on a 640K machine with real mode Windows loaded. A Windows
  411.    application keeps a minimum amount of code loaded in memory; this
  412.    is known as its swapsize. As the program executes and you choose
  413.    various functions, whenever Windows runs out of memory, it discards
  414.    part of the application and overwrites it with new code loaded from
  415.    the executable file on the hard disk.
  416.    
  417.    If XMS memory is accessible to Windows 3.00 via HIMEM.SYS, Windows
  418.    will effectively discard code to extended memory. Rather than
  419.    forgetting about the code segment and overwriting it with new code
  420.    from the executable file, Windows copies the code segment to
  421.    extended memory. Then, instead of having to reload from the
  422.    executable file, Windows can fetch the code from extended memory
  423.    when it is required again. This feature speeds up real mode
  424.    operation considerably; code caching is not present in Windows/286
  425.    versions 2.x. Note that this feature does not replace the Windows
  426.    SMARTDrive disk caching utility. SMARTDrive should still be loaded
  427.    whenever possible.
  428.    
  429.    USING XMS MEMORY IN DOS APPLICATIONS
  430.    
  431.    DOS applications that use XMS memory can also be run from real mode
  432.    Windows if the required amount of XMS memory is specified in the
  433.    PIF (Program Information File). One important point about running
  434.    such applications is that real mode Windows is already using all of
  435.    the available XMS memory for code caching. Therefore, to run a DOS
  436.    application PIF that requires XMS memory, you must swap extended
  437.    memory to disk. For example, assume your machine has 2048K of
  438.    extended memory. You specify in the PIF that your DOS application
  439.    requires 1024K of XMS. Real mode Windows is already using all 2
  440.    megabytes of extended memory. When you run the DOS application, the
  441.    first megabyte of XMS memory is swapped to disk, and the DOS
  442.    application is given access to that megabyte. When you alt+tab back
  443.    to real mode Windows, the original 1024K of XMS memory is reloaded
  444.    from disk. Since this process can be slow, you should not request
  445.    any more XMS memory than is absolutely necessary to run your
  446.    application.
  447.    
  448.    SWAPPING DOS APPLICATIONS TO EXTENDED MEMORY
  449.    
  450.    Real mode Windows 3.00 can also swap DOS applications to extended
  451.    memory. To do this, create a virtual hard disk in extended memory
  452.    with the RAMDRIVE.SYS driver. Then, set the swapdisk= line in the
  453.    [nonwindowsapp] section of the SYSTEM.INI file to point to the
  454.    drive letter that RAMDrive creates. Note that you must have a
  455.    RAMDrive that is at least three times larger than the largest DOS
  456.    application you want to use. Also, be advised that using extended
  457.    memory to create the RAMDrive will reduce real mode Windows'
  458.    extended memory code caching ability and make it run more slowly.
  459.    
  460.       Note: Windows/286 versions 2.x have the ability to swap DOS
  461.       applications directly to expanded memory. Since expanded memory
  462.       is rarely used under Windows 3.00, this capability was removed.
  463.       If you want to swap DOS applications to expanded memory, set up
  464.       a RAMDrive in expanded memory and swap to the RAMDrive.
  465.    
  466.    RUNNING PROTECTED MODE DOS APPLICATIONS
  467.    
  468.    Windows real mode allows DOS applications that use a DOS extender
  469.    technology such as VCPI (Virtual Control Program Interface) to run
  470.    in protected mode. Extended memory allocation for such applications
  471.    must be made in the PIF.
  472.  
  473. STANDARD MODE WINDOWS 3.00
  474. ==========================
  475. Breaking the 640K barrier on 286 machines
  476.  
  477. Standard Mode and Conventional Memory
  478. -------------------------------------
  479.  
  480. When standard mode Windows 3.00 is executed, it adds the amount of
  481. free conventional and extended memory and looks at the total amount as
  482. one contiguous block of memory. Conventional memory has no special
  483. meaning under standard mode, except when running DOS applications.
  484. Running real or standard mode Windows 3.00 has the same DOS
  485. application support, and DOS applications must run within conventional
  486. memory.
  487.  
  488. Standard Mode and the 384K Reserved I/O Address Space
  489. -----------------------------------------------------
  490.  
  491. Windows 3.00 does not access the 384K reserved I/O address space
  492. directly in standard mode. Still, if a physical expanded memory board
  493. is present, the board's EMM will use areas of the 384K reserved I/O
  494. address space. If you suspect a 384K reserved I/O address space
  495. conflict is causing a problem, temporarily remove the external EMM for
  496. testing purposes.
  497.  
  498. Standard Mode and Expanded Memory
  499. ---------------------------------
  500.  
  501. Standard mode Windows 3.00 does not use expanded memory at all. DOS
  502. applications running under standard mode can access expanded memory
  503. only if a physical expanded memory board along with the appropriate
  504. memory manager is present in the machine. Compatible 386 Expanded
  505. Memory Managers such as EMM386.SYS can be loaded to provide expanded
  506. memory outside of Windows. However, 386 Expanded Memory Managers
  507. cannot be used to provide expanded memory to DOS applications running
  508. from standard mode Windows. The 386 Expanded Memory Manager will be
  509. disabled when standard mode loads. See the "Expanded Memory for DOS
  510. Applications" section of this application note for more information on
  511. using EMS with standard mode.
  512.  
  513. Standard Mode and Extended Memory
  514. ---------------------------------
  515.  
  516. Windows 3.00 standard mode can access extended memory directly. It
  517. adds the free conventional memory and free XMS extended memory. It
  518. then provides the total as memory for Windows applications to use
  519. (minus the memory required by standard mode Windows itself). Standard
  520. mode initially accesses extended memory through the XMS driver
  521. HIMEM.SYS. DOS applications that use XMS memory can also be run from
  522. standard mode Windows. Since standard and real mode Windows both use
  523. the same DOS application support, the same restrictions apply (see the
  524. "Real Mode and Extended Memory" section of this application note).
  525.  
  526. ENHANCED MODE WINDOWS 3.00
  527. ==========================
  528. Entering the world of virtual memory
  529.  
  530. Enhanced Mode and Conventional Memory
  531. -------------------------------------
  532.  
  533. Windows 3.00 enhanced mode deals with conventional memory in much the
  534. same way as standard mode. When enhanced mode Windows 3.00 is
  535. executed, it adds the amount of free conventional and extended memory,
  536. but in addition, Windows 3.00 combines a virtual hard drive memory
  537. factor and looks at the total amount as one contiguous block of
  538. memory. Conventional memory has no special meaning under enhanced
  539. mode, except when running DOS applications. Enhanced mode runs DOS
  540. applications by creating virtual DOS machines up to 640K in gross
  541. size.
  542.  
  543. Each virtual DOS machine inherits the environment that was present
  544. before Windows enhanced mode was executed. This means that every
  545. driver and TSR loaded before you run Windows is present and consumes
  546. memory in every subsequent virtual DOS machine. The net memory
  547. available within virtual DOS machines under enhanced mode is slightly
  548. less than the free memory at the DOS prompt before you start Windows.
  549.  
  550. Enhanced Mode and the 384K Reserved I/O Address Space
  551. -----------------------------------------------------
  552.  
  553. Windows/386 versions 2.x use the 384K reserved I/O address space only
  554. to place the expanded memory page frame, and then to a maximum of only
  555. four 16K pages. Windows 3.00 enhanced mode uses the 384K reserved I/O
  556. address space for two purposes: 1) to place DOS protected mode
  557. application program interface (API) translation buffers, and 2) to
  558. place the expanded memory page frame (if required). Frequently, all of
  559. the free pages in the 384K reserved I/O address space are utilized by
  560. enhanced mode.
  561.  
  562.    API TRANSLATION BUFFERS IN THE 384K RESERVED I/O ADDRESS SPACE
  563.    
  564.    Although Windows 3.00 enhanced mode breaks the 640K barrier for
  565.    Windows applications, it still runs on top of DOS. The copy of DOS
  566.    upon which Windows is running can execute and access data only
  567.    within conventional memory. The same restriction applies to network
  568.    software or other drivers loaded before enhanced mode Windows.
  569.    Enhanced mode allocates buffers in the 384K reserved I/O address
  570.    space to translate DOS and network API calls from protected mode to
  571.    real mode. Since the 384K reserved I/O address space is within the
  572.    first megabyte of address space, it can be accessed by DOS in real
  573.    mode. The translation buffers are used as a window through which
  574.    applications executing in protected mode can pass information to
  575.    and from DOS and the network.
  576.    
  577.    Ideally, there would be enough free space in the 384K reserved I/O
  578.    address space to place both the translation buffers and the
  579.    expanded memory page frame. Yet on many configurations there isn't
  580.    enough room. This means you have to make a choice. Either the
  581.    expanded memory page frame can be eliminated or the translation
  582.    buffers can be allocated in conventional memory instead of in the
  583.    384K reserved I/O address space. If the translation buffers are
  584.    allocated in conventional memory, they take up space in every
  585.    virtual machine from Windows that you create. You will have less
  586.    space in virtual machines to run DOS applications. The translation
  587.    buffers can be allocated either in the 384K reserved I/O address
  588.    space or in conventional memory, but never half-and-half.
  589.    
  590.    Fortunately, Windows 3.00 enhanced mode provides a method for
  591.    specifying your preference. To do this, place the following switch
  592.    in the [386ENH] section of the SYSTEM.INI:
  593.    
  594.       ReservePageFrame=Boolean
  595.    
  596.    If ReservePageFrame=true (the default), enhanced mode Windows
  597.    allocates the page frame first and the translation buffers second.
  598.    This makes it likely that the translation buffers will be forced
  599.    into conventional memory but allows you to use expanded memory in
  600.    DOS applications. If ReservePageFrame=false, the translation
  601.    buffers are allocated first and the page frame second if there is
  602.    still room.
  603.    
  604.    This setting gives you the most free memory within virtual
  605.    machines, but you may not be able to use expanded memory in DOS
  606.    applications. However, remember that Windows applications do not
  607.    need expanded memory to function; only DOS applications that can
  608.    utilize expanded memory will be affected. One important note: If
  609.    you are using the EMM386.SYS driver, translation buffers are always
  610.    placed in conventional memory.
  611.    
  612.    PAGE FRAME PLACEMENT IN THE 384K RESERVED I/O ADDRESS SPACE
  613.    
  614.    As noted in the expanded memory discussion earlier in this
  615.    document, expanded memory support requires a page frame located in
  616.    the 384K reserved I/O address space. With LIM 4.0 expanded memory,
  617.    it is not necessary to have a 64K contiguous page frame in this
  618.    area. It's not necessary to have a page frame at all in LIM 4.0.
  619.    Still, if you want to use expanded memory in your DOS applications,
  620.    you must have a 64K contiguous page frame. This is composed of four
  621.    contiguous 16K pages in the 384K reserved I/O address space.
  622.    
  623.    On a typical IBM machine there are only eight free 16K pages in the
  624.    384K reserved I/O address space (refer to Figure 2). Four
  625.    contiguous pages are required for expanded memory support in DOS
  626.    applications, leaving only four other free pages. Other cards such
  627.    as network adapters and ESDI hard disk controllers also need to
  628.    occupy pages in the 384K reserved I/O address space. Frequently the
  629.    combination of installed adapters can break up the free area in the
  630.    384K reserved I/O address space so there is no 64K contiguous area
  631.    in which to place the page frame. In this case, you will not see
  632.    any free expanded memory in your DOS applications running under
  633.    Windows 3.00 enhanced mode.
  634.    
  635.    If you experience this problem, you may need to rearrange your
  636.    adapter memory locations to get expanded memory support for DOS
  637.    applications. This is easiest to do on machines using the Micro
  638.    Channel Architecture (MCA) or Extended Industry Standard
  639.    Architecture (EISA) bus standards. IBM Personal System/2 models 50
  640.    and above are equipped with the Micro Channel bus. The PS/2
  641.    machines allow you to change adapter memory locations simply by
  642.    booting with the PS/2 Reference Disk and choosing Change
  643.    Configuration. A similar procedure is available on most EISA bus
  644.    machines such as the COMPAQ SYSTEMPRO and HP Vectra 486. Normal
  645.    Industry Standard Architecture (ISA) bus machines such as the IBM
  646.    AT and COMPAQ 386 may require you to open the case and flip DIP
  647.    switches on the cards to change their memory addresses. Use Figure
  648.    2 as a handy worksheet when readdressing adapters to open a 64K
  649.    page frame.
  650.    
  651.    If you want, you can disable expanded memory support entirely under
  652.    Windows 3.00 enhanced mode by adding the NoEMMDriver=yes parameter
  653.    in the [386ENH] section of the SYSTEM.INI file.
  654.    
  655.    CONTROLLING ENHANCED MODE 384K RESERVED I/O ADDRESS SPACE MAPPING
  656.    
  657.    In Windows/386 versions 2.x, the WIN.INI parameters EMMExclude= and
  658.    EMMInclude= are used to control expanded memory page frame
  659.    placement. These parameters are used under Windows 3.00 enhanced
  660.    mode to control not only the expanded memory page frame but also
  661.    the API translation buffer mapping. Under Windows 3.00 these
  662.    switches begin with the letters EMM only for downward compatibility
  663.    reasons. They no longer apply only to expanded memory. The
  664.    EMMPageFrame= parameter still applies only to the expanded memory
  665.    page frame. In Windows 3.00 these switches have been moved from the
  666.    WIN.INI file to the [386ENH] section of the SYSTEM.INI. Windows/386
  667.    versions 2.x do not use the E000-EFFF area of the 384K reserved I/O
  668.    address space unless specifically instructed. Windows 3.00 enhanced
  669.    mode will use this segment unless the machine identifies itself as
  670.    a PS/2.
  671.    
  672.    To explicitly exclude an area of the 384K reserved I/O address
  673.    space from mapping by Windows 3.00 enhanced mode, use the
  674.    EMMExclude= statement. The EMMExclude= parameter accepts a four-
  675.    digit hexadecimal memory range, such as EMMExclude=E000-EFFF. Since
  676.    there is no standard for hardware implementation of the E000-EFFF
  677.    area, it is frequently necessary to exclude this range for enhanced
  678.    mode to function properly. Most adapter cards are automatically
  679.    detected and excluded by Windows 3.00 enhanced mode. If you suspect
  680.    a problem with a 384K reserved I/O address space memory conflict,
  681.    use EMMExclude=.
  682.    
  683.    There are very few uses for the EMMInclude= statement. Normally
  684.    Windows 3.00 enhanced mode automatically uses all free pages in the
  685.    384K reserved I/O address space. Likewise, there are few uses for
  686.    the EMMPageFrame= statement, since it controls only the expanded
  687.    memory page frame and not the translation buffers. The Windows/386
  688.    2.x LastEMMSeg= parameter is not used by Windows 3.00.
  689.  
  690. Enhanced Mode and Expanded Memory
  691. ---------------------------------
  692.  
  693. Windows 3.00 enhanced mode does not use expanded memory itself. It can
  694. create expanded memory for use by DOS applications written to use
  695. expanded memory, such as Lotus 1-2-3. Expanded memory required by a
  696. DOS application can be specified in the Advanced section of the
  697. application's PIF. It is no longer necessary for Windows applications
  698. to use expanded memory because they can now access extended memory
  699. directly. The main issues for expanded memory under Windows 3.00 are
  700. page frame conflicts, as discussed above.
  701.  
  702. Windows/386 versions 2.x provide large page frame expanded memory only
  703. for the Windows virtual machine. Windows 3.00 enhanced mode provides
  704. large page frame LIM 4.0 expanded memory in all virtual DOS machines.
  705. This is not currently useful for most DOS applications that use
  706. expanded memory. Most DOS applications use only the 64K page frame
  707. itself, not the additional bankable pages in conventional memory that
  708. large page frame LIM 4.0 supplies. However, this feature may be useful
  709. in the future.
  710.  
  711. A compatible external 386 memory manager such as EMM386.SYS can be
  712. loaded to provide expanded memory for DOS applications running outside
  713. of Windows 3.00 enhanced mode. Note: EMM386.SYS is specifically
  714. designed to work in conjunction with Windows 3.00. This driver is not
  715. needed to have expanded memory available inside of Windows 3.00 and is
  716. actually turned off when Windows 3.00 enhanced mode is run. See the
  717. "Expanded Memory for DOS Applications" section of this application
  718. note for more information.
  719.  
  720. Enhanced Mode and Extended Memory
  721. ---------------------------------
  722.  
  723. Like standard mode, Windows 3.00 enhanced mode can access extended
  724. memory directly. It adds the free conventional memory and free XMS
  725. extended memory plus a virtual hard drive memory factor. It then
  726. provides the total as memory for Windows applications to use (minus
  727. the memory required by enhanced mode Windows itself). DOS applications
  728. that use XMS memory can also access XMS in virtual machines under
  729. enhanced mode Windows. The XMS memory supplied to DOS applications by
  730. Windows 3.00 enhanced mode can be virtualized.
  731.  
  732.    RUNNING PROTECTED MODE DOS APPLICATIONS
  733.    
  734.    Windows enhanced mode allows DOS applications to run in protected
  735.    mode if they are written to use the Microsoft DOS Protected Mode
  736.    Interface (DPMI) specification.
  737.    
  738.       NOTE: Enhanced mode uses the XMS to initially load itself and
  739.       its drivers into extended memory before starting up. This is why
  740.       enhanced mode requires the presence of HIMEM.SYS, the XMS device
  741.       driver.
  742.  
  743. Enhanced Mode and Virtual Memory
  744. --------------------------------
  745.  
  746.    A VIRTUAL MEMORY CONCEPTUAL ANALYSIS
  747.    
  748.    Virtual memory gives you the ability to run more simultaneous
  749.    programs than the amount of physical memory installed on your
  750.    computer would normally allow. Virtual memory has been widely used
  751.    for years in the world of mainframe computers and recently came to
  752.    the IBM world with the introduction of the IBM/Microsoft OS/2
  753.    operating system, which is based on the 80286 processor. Windows
  754.    3.00 enhanced mode goes beyond the world of OS/2 to offer virtual
  755.    memory using the special demand paging capabilities of the Intel
  756.    80386 processor.
  757.    
  758.    The best thing about virtual memory in Windows 3.00 enhanced mode
  759.    is that programs do not need to be written specifically to take
  760.    advantage of it. When you start Windows 3.00 enhanced mode and from
  761.    the Help menu, choose Help About Program Manager, you will see that
  762.    much more memory is available than is installed in your machine.
  763.    Windows applications can use this extra memory without being
  764.    written specially for it because Windows applications are device
  765.    independent. They let Windows handle the memory management and
  766.    simply ask Windows for memory allocations. With virtual memory,
  767.    Windows applications keep asking for more memory, which Windows
  768.    3.00 enhanced mode is now able to deliver. If you have less memory,
  769.    the application runs slower; if you have more memory, it runs
  770.    faster; but it is almost always able to run.
  771.    
  772.    At any given moment during the execution of a program, some parts
  773.    of its code and data are in physical memory; the rest is swapped to
  774.    the hard disk. Whenever a reference is made to a memory address, if
  775.    the information is currently in physical memory, it is used without
  776.    program interruption. If the information isn't in physical memory,
  777.    a page fault occurs. The Windows 3.00 enhanced mode virtual memory
  778.    manager takes control.
  779.    
  780.    The required code or data is pulled into physical memory from the
  781.    hard disk, and if necessary, some other information is swapped out.
  782.    Pages are swapped out on a least recently used (LRU) basis. The
  783.    page(s) that have not been accessed for the longest time are the
  784.    first to be swapped out. All this swapping occurs without notice to
  785.    the user, who sees only a little hard disk activity.
  786.    
  787.    Windows 3.00 enhanced mode virtual memory is a demand-paged system.
  788.    This means that pages of data are brought into physical memory when
  789.    they are referenced. A demand-paged system does not attempt to
  790.    predict what pages will be required in the future. The enhanced
  791.    mode virtual memory subsystem is implemented by the Windows 3.00
  792.    Virtual Memory Manager (VMM) along with the pageswap device. The
  793.    VMM maintains the virtual memory page table. The page table lists
  794.    which pages are currently in physical memory and which are swapped
  795.    to disk. Because Windows 3.00 enhanced mode is a multitasking
  796.    environment, the VMM page table also contains a list of which
  797.    memory pages belong to which process. When the VMM needs a page
  798.    that is not currently in physical memory, it calls the pageswap
  799.    device. Pageswap allocates and deallocates virtual memory and maps
  800.    pages into and out of physical memory.
  801.    
  802.    Some virtual memory systems rely on program segmentation to do
  803.    their work. Windows applications are segmented. However, virtual
  804.    memory under Windows 3.00 enhanced mode is not related to the
  805.    segmentation of Windows applications. All memory, virtual and
  806.    physical, is divided into 4K pages and the system is managed on
  807.    this basis. Page mapping starts at 0 kilobytes and works up. There
  808.    are two kinds of pages that can be allocated: physical pages and
  809.    virtual pages. The amount of physical pages is simply the amount of
  810.    physical memory in the machine divided by 4K. In contrast, memory
  811.    allocated to an application is made up of virtual pages. At any
  812.    given time, a virtual page can be in physical memory or swapped to
  813.    the hard disk.
  814.    
  815.    As mentioned above, Windows 3.00 enhanced mode virtual memory
  816.    management uses the least recently used (LRU) page replacement
  817.    algorithm. The virtual page table contains flags for each page that
  818.    indicate whether the page has been "accessed" and if the page is
  819.    "dirty." Accessed means that a process has made a reference to the
  820.    page since it was originally loaded. Dirty means that a write has
  821.    been made to the page since it was loaded. Because a memory write
  822.    qualifies as an access, the Dirty attribute implies the Accessed
  823.    attribute.
  824.    
  825.    To illustrate, assume Windows 3.00 enhanced mode is out of physical
  826.    memory space. A process requests additional memory. Windows has to
  827.    decide which page(s) currently in physical memory it should swap to
  828.    disk to fulfill the request. This decision is a three-step process:
  829.    
  830.    1. The virtual memory manager scans the page table, looking for
  831.       pages that have neither an Accessed nor a Dirty attribute.
  832.       During the scanning process, it clears the Accessed attribute
  833.       from all the pages.
  834.    
  835.    2. If it can find enough pages meeting the not Accessed/not Dirty
  836.       requirement, it fulfills the request. It swaps the pages to disk
  837.       and gives the resulting free memory to the process.
  838.    
  839.    3. If it can't find enough pages the first time through, it repeats
  840.       the scan. Yet this time through, none of the pages has an
  841.       Accessed attribute because it was cleared by the first scan.
  842.       Theoretically, therefore, more pages will meet the requirements,
  843.       and the request can be fulfilled. If the required pages are
  844.       still not found by the second scan, Windows then swaps out the
  845.       pages regardless of their attributes.
  846.    
  847.    The benefit of Windows 3.00 enhanced mode virtual memory support is
  848.    the ability to run more programs than could be supported by actual
  849.    physical memory. The drawbacks are the disk space requirement for
  850.    the virtual memory swap file and a decrease in overall execution
  851.    speed when swapping is required. However, it's better to be able to
  852.    run a program slowly in a virtual memory system than not to be able
  853.    to run it at all.
  854.    
  855.    VIRTUAL MEMORY PAGING FILE OPTIONS AND CONTROLS
  856.    
  857.    Windows 3.00 enhanced mode can use one of two types of virtual
  858.    memory paging files, or swap files: temporary or permanent. Only
  859.    one type of swap file can be used when running Windows 3.00. Do not
  860.    attempt to create a swap file on a RAMDisk. Creating a swap file on
  861.    a RAMDisk is a self-defeating pursuit -- you would be sacrificing
  862.    physical memory to provide a place to create virtual memory to
  863.    replace the physical memory you have used to create the RAMDisk.
  864.    Windows 3.00 in 386 enhanced mode requires a minimum of
  865.    approximately 1.5 megabytes of hard disk space free on the paging
  866.    drive to provide virtual memory support with a temporary swap file.
  867.    
  868.    A temporary swap file is simply a normal DOS file created on the
  869.    hard disk that can shrink and grow in size as necessary. The
  870.    temporary swap file is called WIN386.SWP. It does not have a Hidden
  871.    or System attribute and can be deleted at any time you are not
  872.    currently running Windows, if necessary. It is normally deleted
  873.    automatically when you exit Windows 3.00 enhanced mode. This
  874.    temporary swap file is the default swap file that Windows 3.00 uses
  875.    and is created automatically when Windows 3.00 is started.
  876.    
  877.    Temporary swap file location and size can be adjusted by inserting
  878.    parameters in the [386ENH] section of the SYSTEM.INI file. The
  879.    temporary swap file is always created in your Windows 3.00
  880.    directory unless you set the PagingDrive= parameter. If the
  881.    PagingDrive= parameter is set (for example, PagingDrive=D:), the
  882.    swap file will be created in the root directory of the specified
  883.    drive. There is no way to specify a subdirectory for the temporary
  884.    swap file location. Temporary swap file size is controlled by the
  885.    MaxPagingFileSize= parameter. The size of the temporary swap file
  886.    can also be limited in a different way by the use of the
  887.    MinUserDiskSpace= parameter, which tells enhanced mode to leave the
  888.    specified amount of disk space in kilobytes free when creating a
  889.    temporary swap file.
  890.    
  891.    A permanent swap file occupies a contiguous section of your hard
  892.    disk. Because it is contiguous, using a permanent swap file
  893.    moderately improves the speed of the Windows 3.00 virtual memory
  894.    system, and its access requires less overhead than a normal DOS
  895.    file. The permanent swap file is a hidden file called 386SPART.PAR,
  896.    which also has a System attribute. It is always placed in the root
  897.    directory. Since the permanent swap file must be contiguous, you
  898.    can't create a permanent swap file larger than the largest
  899.    contiguous free segment of your hard disk.
  900.    
  901.    Permanent swap files are created and deleted with the Windows 3.00
  902.    SWAPFILE.EXE utility program. A SYSTEM.INI parameter is not used to
  903.    point to the location of the permanent swap file. Instead, the
  904.    Swapfile utility program creates a SPART.PAR file in your Windows
  905.    3.00 directory. Windows 3.00 enhanced mode reads the SPART.PAR file
  906.    to find out where the permanent swap file is and how large it is.
  907.    SPART.PAR is marked read-only to keep you from accidentally
  908.    deleting it. If you delete SPART.PAR, Windows will not know about
  909.    the permanent swap file. Also you can't delete the permanent swap
  910.    file with the Swapfile utility because Swapfile also reads
  911.    SPART.PAR.
  912.    
  913.    The Swapfile utility makes DOS calls that cannot be made from
  914.    protected mode Windows. Therefore, SWAPFILE.EXE can be run only
  915.    from real mode Windows 3.00 to create or delete a permanent swap
  916.    file and cannot run with other applications. If the Swapfile
  917.    utility program says that the maximum swap file size it can create
  918.    is smaller than your free disk space, your hard disk is fragmented.
  919.    
  920.    If you want to create a larger permanent swap file, you must
  921.    optimize your hard disk (optimizing is also known as unfragmenting,
  922.    or compacting). This must be done with a third-party utility
  923.    program such as Bridgeway Publishing FastTrax, Norton Utilities,
  924.    Mace Utilities, Golden Bow VOpt, or Central Point PCTools. If you
  925.    have already created a permanent swap file, make sure to delete it
  926.    using the Swapfile utility program before optimizing your hard
  927.    disk. It is not necessary to delete the permanent swap file every
  928.    time you optimize your hard disk -- only when you want to increase
  929.    the size of the permanent swap file by optimizing, then re-creating
  930.    it.
  931.    
  932.    The Swapfile utility program supports only disks that use 512-byte
  933.    sectors. If 512-byte sectors are not being used, this indicates a
  934.    nonstandard configuration such as a third-party disk partitioning
  935.    driver. Swapfile (and Windows 3.00 itself) supports drives with
  936.    512-byte sectors that have been partitioned with the DOS FDISK
  937.    utility. Never run Swapfile on a drive that uses a partitioning
  938.    driver in the CONFIG.SYS, with the exception of COMPAQ's
  939.    ENHDISK.SYS. If you receive a message that your swap file is
  940.    corrupted, run the Swapfile utility, delete the current swap file,
  941.    and create a new one.
  942.    
  943.    PAGING TO NETWORK DRIVES
  944.    
  945.    Paging to a network drive, while certainly possible, is extremely
  946.    slow and is not recommended. Only temporary swap files can be used
  947.    on network drives. If you want to page to a net drive, the
  948.    directory must not have a DOS Read-Only attribute. You must have
  949.    Create and Write access to the directory. Note that because they
  950.    are not MSNet-Redirector compatible, the root of a Novell network
  951.    drive is the root of the server. Do not set the PagingDrive=
  952.    parameter to a Novell network drive. If you do so and multiple
  953.    users run Windows 3.00 enhanced mode, their computers will hang
  954.    because they will overwrite each other's swap files, all with the
  955.    same name and all created in the root directory of the server.
  956.  
  957.  
  958. ======================================================================
  959.                 WIN.COM AUTOMATIC START-UP PARAMETERS
  960. ======================================================================
  961.  
  962. WIN.COM starts up automatically in the appropriate Windows 3.00
  963. operating mode for your machine and the amount of memory installed.
  964. These modes are real mode (similar to Windows/286 2.x), 286 standard
  965. mode (also known as 286 protected mode), and 386 enhanced mode (also
  966. known as 386 protected mode). However, Windows may be forced into one
  967. of the three modes through the following command-line switches:
  968.  
  969.       Command Line        Mode
  970.       ------------        ----
  971.       
  972.       WIN /R              Real
  973.       
  974.       WIN /S or WIN /2    Standard
  975.       
  976.       WIN /3              Enhanced
  977.  
  978. REAL MODE REQUIREMENTS
  979. ======================
  980.  
  981. The requirements for WIN.COM to automatically start up in real mode
  982. are the following:
  983.  
  984. * 8088 processor or above
  985.  
  986. * 384K of free conventional memory (393,216 bytes reported by CHKDSK)
  987.  
  988. STANDARD MODE REQUIREMENTS
  989. ==========================
  990.  
  991. The requirements for WIN.COM to automatically start up in standard
  992. mode are the following:
  993.  
  994. * 80286 processor or above
  995.  
  996. * 192K of free extended memory
  997.  
  998. * XMS driver loaded (HIMEM.SYS)
  999.  
  1000.    ACTUAL STANDARD MODE REQUIREMENTS
  1001.    
  1002.    Standard mode conventional/extended memory requirements are
  1003.    mutually dependent and are not fixed. A typical installation
  1004.    requires a minimum of 128K free at the DOS prompt to run standard
  1005.    mode, assuming sufficient extended memory is free. Standard mode
  1006.    requires between 384K and 512K combined conventional and extended
  1007.    memory to run (approximately).
  1008.    
  1009.    For example, if only the minimum 192K of extended memory is free,
  1010.    approximately 322K of conventional memory is required to run
  1011.    standard mode. However, If available extended memory is increased
  1012.    to approximately 208K or greater, only 128K of conventional memory
  1013.    is required. This example is intended to illustrate that memory
  1014.    requirements are interrelated and variable.
  1015.  
  1016. ENHANCED MODE REQUIREMENTS
  1017. ==========================
  1018.  
  1019. The requirements for WIN.COM to automatically start up in enhanced
  1020. mode are the following:
  1021.  
  1022. * 80386 processor or above
  1023.  
  1024. * 1024K of free extended memory
  1025.  
  1026. * XMS driver loaded (HIMEM.SYS)
  1027.  
  1028.    ACTUAL ENHANCED MODE REQUIREMENTS
  1029.    
  1030.    See the above notes for standard mode regarding the
  1031.    interrelationship of conventional and extended memory requirements.
  1032.    A typical installation requires a minimum of 182K free at the DOS
  1033.    prompt to run enhanced mode, assuming sufficient extended memory is
  1034.    free. Enhanced mode requires between 580K and 624K combined
  1035.    conventional and extended memory to run (approximately).
  1036.    
  1037.    Note that enhanced mode can start up in low memory situations only
  1038.    because it provides virtual memory support. However, it may be
  1039.    extremely slow due to the large amount of disk swapping it must
  1040.    perform.
  1041.    
  1042.    All numbers are approximate and may vary widely depending on the
  1043.    configuration (for example, Windows device drivers chosen, DOS
  1044.    version, display adapter, etc.). 128K of extended memory is
  1045.    recovered from shadow RAM usage on COMPAQ 386 machines. Memory
  1046.    requirements take into account memory that can be recovered from
  1047.    SMARTDrive (down to the minimum cache size specified).
  1048.  
  1049.  
  1050. ======================================================================
  1051.                  THE FREE SYSTEM RESOURCES PERCENTAGE
  1052. ======================================================================
  1053.  
  1054. The Program Manager and File Manager Help About boxes in Windows 3.00
  1055. standard and enhanced modes give percentage figures for Free System
  1056. Resources and Free Memory. To understand what the Free System
  1057. Resources percentage means, you must understand some of the anatomy of
  1058. Windows' internal structure.
  1059.  
  1060. The part of Windows that runs Windows applications is made up of three
  1061. main segments called KERNEL, GDI (graphics device interface), and
  1062. USER. KERNEL loads and executes Windows applications and handles their
  1063. memory management. GDI manages graphics and printing. USER controls
  1064. user input and output, including the keyboard, mouse, sound driver,
  1065. timer, and communications ports. In Windows 2.x these modules are
  1066. linked to the files WIN200.BIN and WIN200.OVL by the Setup program, so
  1067. you can't see them in the Windows directory. In Windows 3.00, they're
  1068. separate and are located in the SYSTEM subdirectory.
  1069.  
  1070. Both USER and GDI have storage areas that are limited to 64K in size.
  1071. A storage area limited to 64K is known as a local heap. The Free
  1072. System Resources percentage reflects the remaining free percentage of
  1073. combined USER and GDI local heap space. Although Windows 3.00 allows
  1074. you to run a much larger number of simultaneous Windows applications
  1075. than any previous Windows version, it is not without limitations. If
  1076. you receive an Out of Memory error and the Help About box shows a
  1077. large amount of Free Memory, look at the Free System Resources
  1078. percentage. Chances are you are low on system resources.
  1079.  
  1080. Every window, subwindow, and icon that is created requires GDI local
  1081. heap space. It is theoretically possible to exhaust the system
  1082. resources with only one application, such as Program Manager, if
  1083. enough objects are created by the application.
  1084.  
  1085. Another important aspect of Windows application memory management that
  1086. is not included in the Free System Resources percentage is the number
  1087. of selectors. A selector is a memory pointer that is consumed with
  1088. each memory allocation made by a Windows application. Windows 3.00 has
  1089. a fixed number of selectors. If a Windows application allocates a very
  1090. large number of small data objects, it is possible to run out of
  1091. selectors. This will produce an Out of Memory error message.
  1092.  
  1093. Writing a Windows application to handle its own data objects more
  1094. efficiently can help in this situation. If you experience a chronic
  1095. problem with a particular application while few or no other
  1096. applications are loaded, contact the application vendor. It is
  1097. important that the vendor becomes aware of the problem so the problem
  1098. can be corrected if possible. However, please note that this is a
  1099. Windows 3.00 limitation, not an application problem. Writing an
  1100. application to handle data objects efficiently can reduce, but not
  1101. eliminate, the problem.
  1102.  
  1103.  
  1104. ======================================================================
  1105.                     ENHANCED MODE PERFORMANCE TIPS
  1106. ======================================================================
  1107.                   Getting the most from your machine
  1108.  
  1109. The following suggestions should assist in maximizing the performance
  1110. of your Windows 3.00 enhanced mode installation. Many of these
  1111. suggestions apply to standard and real modes as well.
  1112.  
  1113. 1. Use SMARTDrive.
  1114.  
  1115.    The Microsoft SMARTDrive disk caching driver can produce the
  1116.    largest single Windows 3.00 performance improvement. Use SMARTDrive
  1117.    whenever possible. Allocate the largest amount of memory to
  1118.    SMARTDrive without impairing your ability to run your desired
  1119.    applications. For basic information on SMARTDrive installation and
  1120.    operation, refer to the Microsoft Windows User's Guide version 3.0
  1121.    manual.
  1122.  
  1123. 2. Keep your hard disk optimized.
  1124.  
  1125.    A fragmented hard disk greatly impacts Windows' performance,
  1126.    especially when a temporary swap file and/or SMARTDrive is
  1127.    installed. Use a hard disk optimizer program on a weekly basis to
  1128.    keep your disk contiguous.
  1129.  
  1130. 3. Create a permanent swap file.
  1131.  
  1132.    Using a permanent swap file improves performance over using a
  1133.    temporary one. See the "Enhanced Mode and Virtual Memory" section
  1134.    of this application note for more information on permanent swap
  1135.    file allocation.
  1136.  
  1137. 4. Turn off graphics port trapping.
  1138.  
  1139.    The speed of running DOS applications under enhanced mode can be
  1140.    noticeably improved by not selecting any of the Monitor Ports
  1141.    options in the Advanced section of the PIF Editor. The High
  1142.    Graphics option is on by default to provide the widest range of DOS
  1143.    application compatibility but is not required for most
  1144.    applications.
  1145.  
  1146. 5. Turn off the FileSysChange= option.
  1147.  
  1148.    Windows 3.00 enhanced mode can monitor disk access by DOS
  1149.    applications and send directory update messages to the File
  1150.    Manager. This allows the File Manager to be automatically updated
  1151.    by changes made to files or directories by DOS applications.
  1152.    However, it is not a necessity and leaving this option off (the
  1153.    default) speeds file access by DOS applications. To disable this
  1154.    feature, set FileSysChange=no in the [386ENH] section of the
  1155.    SYSTEM.INI file.
  1156.  
  1157. 6. Turn off the ReservePageFrame= option.
  1158.  
  1159.    Turn this option off if you do not require expanded memory support
  1160.    for DOS applications. Turning this option off ensures that you're
  1161.    getting the most possible memory in virtual machines. To disable
  1162.    this feature, set ReservePageFrame=no in the [386ENH] section of
  1163.    the SYSTEM.INI file.
  1164.  
  1165. 7. Use the right number of DOS buffers.
  1166.  
  1167.    If you are using SMARTDrive, set the number of DOS disk access
  1168.    buffers in your CONFIG.SYS file to 15 (that is, BUFFERS=15). Using
  1169.    a greater number of buffers with SMARTDrive will actually decrease
  1170.    efficiency. If you are not using SMARTDrive, use BUFFERS=30.
  1171.  
  1172. 8. Use the lowest common display driver.
  1173.  
  1174.    Using a display driver with a higher resolution or greater number
  1175.    of colors results in slower display performance. If you do not
  1176.    require the extra features of the display driver, use a driver with
  1177.    less capability. Usually this suggestion applies to display systems
  1178.    that are VGA compatible but offer an extended mode driver, such as
  1179.    the Video Seven or 8514. Using the standard VGA driver instead
  1180.    offers faster display performance but less resolution and/or color
  1181.    support.
  1182.  
  1183. 9. Use the proper hard disk interleave.
  1184.  
  1185.    Frequently, a hard disk is formatted with the wrong interleave at
  1186.    the dealer or factory. You can use a program such as Gibson
  1187.    Research's SpinRite to verify that you are using the proper
  1188.    interleave. Some utilities can correct your interleave without
  1189.    reformatting the hard disk.
  1190.  
  1191.                                    
  1192. ======================================================================
  1193.                  EXPANDED MEMORY FOR DOS APPLICATIONS
  1194. ======================================================================
  1195.  
  1196. UNDER REAL MODE WINDOWS 3.00
  1197. ============================
  1198.  
  1199. Real mode Windows 3.00 and DOS applications can both use the same
  1200. external Expanded Memory Manager (EMM). Expanded memory can be
  1201. provided either by a physical expanded memory board, or by a 386
  1202. Expanded Memory Manager. Common expanded memory boards include the
  1203. Intel Above Board and AST RAMpage. Common 386 Expanded Memory Managers
  1204. include Microsoft EMM386.SYS (included with the Windows product),
  1205. COMPAQ CEMM.EXE (included with COMPAQ 386 machines), Qualitas 386 to
  1206. the Max (386MAX.SYS), and Quarterdeck QEMM.SYS.
  1207.  
  1208. If a physical expanded memory board is used, you will get the best
  1209. performance from real mode Windows by backfilling to provide large
  1210. page frame LIM 4.0 support. Some boards do not have the hardware
  1211. register support to provide large page frame LIM 4.0 -- only small
  1212. page frame (see the "Expanded Memory" section of this application
  1213. note). All 386 Expanded Memory Managers provide large page frame LIM
  1214. 4.0 support.
  1215.  
  1216. Remember that DOS applications require LIM 3.2 (a 64K contiguous page
  1217. frame) to use expanded memory, but real mode Windows requires LIM 4.0
  1218. (does not require a 64K contiguous page frame). If you see expanded
  1219. memory in Windows but not in your DOS applications, you probably do
  1220. not have a 64K contiguous page frame (LIM 3.2), and you may need to
  1221. rearrange adapter locations. Refer to the "Expanded Memory" section of
  1222. this application note for more information.
  1223.  
  1224. UNDER STANDARD MODE WINDOWS 3.00
  1225. ================================
  1226.  
  1227. As noted in the standard mode section of "Windows 3.00 Modes and
  1228. Memory Usage" of this application note, Windows 3.00 standard mode
  1229. does not use expanded memory. DOS applications running under standard
  1230. mode can use expanded memory only with a physical expanded memory card
  1231. such as an Intel Above Board or AST RAMPage. 386 Expanded Memory
  1232. Managers cannot be used to provide expanded memory support for DOS
  1233. applications running from standard mode. Still, 386-compatible EMMs
  1234. can be loaded to provide DOS application expanded memory support
  1235. outside of standard mode.
  1236.  
  1237. UNDER ENHANCED MODE WINDOWS 3.00
  1238. ================================
  1239.  
  1240. Expanded memory emulation is provided internally for DOS applications
  1241. running under enhanced mode. The only requirement is the presence of a
  1242. 64K contiguous page frame. See the "Enhanced Mode and the 384K
  1243. Reserved I/O Address Space" section of this application note for more
  1244. information on page frame placement. Expanded memory for DOS
  1245. applications can be allocated and/or limited via PIF parameters.
  1246.  
  1247. EXTERNAL 386 EXPANDED MEMORY MANAGERS
  1248. =====================================
  1249.  
  1250. Some 386 Expanded Memory Managers have a special feature that allows
  1251. standard or enhanced mode Windows to turn them off when Windows is
  1252. run. Memory managers with this capability are EMM386.SYS and CEMM.EXE.
  1253. Windows can turn off EMM386.SYS even if expanded memory is in use at
  1254. the time. CEMM.EXE requires that no expanded memory be in use when
  1255. standard or enhanced mode Windows is run. Other memory managers such
  1256. as 386MAX and QEMM cannot be loaded with standard or enhanced mode
  1257. Windows.
  1258.  
  1259. Some 386 Expanded Memory Managers provide the capability to load DOS
  1260. device drivers into free areas of the 384K reserved I/O address space.
  1261. This process works correctly under real mode Windows, and if you must
  1262. run real mode, this is recommended for best performance. EMM386.SYS
  1263. and CEMM.EXE do not provide this capability, but 386MAX.SYS and
  1264. QEMM.SYS do.
  1265.  
  1266. If you plan to switch back and forth between real mode and standard or
  1267. enhanced mode Windows 3.00, we recommend using EMM386.SYS. Neither
  1268. standard nor enhanced mode will run with 386MAX or QEMM. Using one of
  1269. these memory managers requires you to reboot with a different
  1270. CONFIG.SYS and AUTOEXEC.BAT to switch between Windows 3.00 operating
  1271. modes. Using EMM386.SYS allows you to run whichever mode you want.
  1272.  
  1273.                                    
  1274. ======================================================================
  1275.                             DPMI AND VCPI
  1276. ======================================================================
  1277.  
  1278. SPECIFICATIONS FOR DIFFERENT PURPOSES
  1279. =====================================
  1280.  
  1281. The DOS Protected Mode Interface (DPMI) was developed by a group of
  1282. industry leaders including Borland, Eclipse, IBM, IGC, Intel, Locus,
  1283. Lotus, Microsoft, Phar Lap, Quarterdeck, and Rational Systems. Several
  1284. members of the DPMI committee were also involved in the creation of
  1285. the Virtual Control Program Interface (VCPI). DPMI is primarily a
  1286. creation of Microsoft, and VCPI was formulated primarily by Phar Lap
  1287. Software.
  1288.  
  1289. DOS EXTENDED APPLICATIONS
  1290. =========================
  1291.  
  1292. DOS extended applications execute code in the protected mode of the
  1293. 80286 or 80386 processor. Unlike OS/2 applications, DOS extended
  1294. applications are launched from standard MS-DOS or PC-DOS. Creating a
  1295. DOS extended application requires a method to switch the processor to
  1296. protected mode and to allocate extended memory. Until DPMI, there has
  1297. been no standard method for DOS extended applications to perform these
  1298. tasks plus multitask memory with other applications on 80286
  1299. processors. Hundreds of existing applications have been created using
  1300. various types of DOS extenders. OS/2 extender applications that do not
  1301. already support DPMI will require minor modifications to do so.
  1302.  
  1303. COMPARING VCPI TO DPMI
  1304. ======================
  1305.  
  1306. VCPI and DPMI solve two different problems. VCPI provides an interface
  1307. between applications using DOS extenders on an 80386 machine, and 386
  1308. Expanded Memory Managers. For example, the 386 Expanded Memory
  1309. Managers QEMM, 386MAX, and CEMM support the VCPI specification. VCPI
  1310. allows applications using DOS extenders to run simultaneously with 386
  1311. Expanded Memory Managers on a 386 machine.
  1312.  
  1313. However, multitasking operating environments such as Windows 3.00
  1314. enhanced mode, OS/2, UNIX 386, and VM386 have memory and protection
  1315. models that are not compatible with the VCPI interface. DPMI was
  1316. created so these environments can run extended DOS applications.
  1317. Additionally, DPMI provides support for 80286-based machines, which
  1318. VCPI does not. DPMI has the capability of running DOS extended
  1319. applications on a variety of processors and operating environments.
  1320.  
  1321.                                    
  1322. ======================================================================
  1323.                                GLOSSARY
  1324. ======================================================================
  1325.  
  1326. 386 Expanded Memory      A device driver loaded that provides expanded
  1327. Manager (EMM)            memory on an 80386-based computer without a
  1328.                          physical expanded memory board. 386 Expanded
  1329.                          Memory Managers operate via the 386
  1330.                          processor's hardware capabilities.
  1331.  
  1332. 386MAX.SYS               A 386 Expanded Memory Manager from Qualitas
  1333.                          Corp.
  1334.  
  1335. CEMM.EXE                 A 386 Expanded Memory Manager from COMPAQ.
  1336.                          CEMM is provided with all COMPAQ 386-based
  1337.                          computers. It carries an extension of .EXE
  1338.                          rather than .SYS even though it is installed
  1339.                          in the CONFIG.SYS file like other 386
  1340.                          Expanded Memory Managers.
  1341.  
  1342. Conventional Memory      The memory in your machine from 0K to 640K.
  1343.  
  1344. DPMI                     The DOS Protected Mode Interface (DOS
  1345.                          extender industry standard). Applications
  1346.                          that use the DPMI specification can run in
  1347.                          protected mode and break the 640K barrier
  1348.                          under standard or enhanced mode Windows 3.00.
  1349.                          The DPMI specification is available from
  1350.                          Intel Corporation.
  1351.  
  1352. EMM386.SYS               The Microsoft 386 Expanded Memory Manager.
  1353.                          See the Windows 3.00 user's guide for more
  1354.                          information.
  1355.  
  1356. EMM                      Expanded Memory Manager.
  1357.  
  1358. EMS                      Expanded Memory Standard. There are two
  1359.                          Expanded Memory Standards, which are
  1360.                          designated LIM 3.2 and LIM 4.0.
  1361.  
  1362. Expanded Memory Manager  A device driver that provides an interface to
  1363. (EMM)                    expanded memory. An Expanded Memory Manager,
  1364.                          or EMM, is either specific to a particular
  1365.                          physical expanded memory board, or uses the
  1366.                          386 processor.
  1367.  
  1368. Extended Memory          Memory in your machine above 1 MB. Extended
  1369.                          memory always starts at 1024K.
  1370.  
  1371. Large Page Frame         A slang term denoting the presence of
  1372.                          bankable expanded memory pages in
  1373.                          conventional memory. It is usually used to
  1374.                          refer to an amount of bankable pages equal to
  1375.                          or greater than 384K (that is, bankable pages
  1376.                          ranging from 256K to 640K). Note that the
  1377.                          term "large page frame" is a misnomer. The
  1378.                          page frame is actually never any larger than
  1379.                          four 16K pages and is always located in the
  1380.                          384K reserved I/O address space. Additional
  1381.                          bankable pages in conventional memory do not
  1382.                          make the page frame larger; they simply
  1383.                          provide additional bankable pages.
  1384.  
  1385. LIM 3.2                  The Lotus/Intel/Microsoft expanded memory
  1386.                          standard (EMS) version 3.2. It provides for a
  1387.                          maximum of four 16K bankable pages that must
  1388.                          be contiguous.
  1389.  
  1390. LIM 4.0                  The Lotus/Intel/Microsoft expanded memory
  1391.                          standard (EMS) version 4.0. It provides for a
  1392.                          maximum of 64 16K bankable pages, which do
  1393.                          not have to be contiguous.
  1394.  
  1395. Page Frame               An area within the 384K reserved I/O address
  1396.                          space that is designated the expanded memory
  1397.                          page frame. The page frame itself can be a
  1398.                          maximum of four 16K pages.
  1399.  
  1400. QEMM386                  A 386 Expanded Memory Manager by Quarterdeck
  1401.                          Corp.
  1402.  
  1403. Small Page Frame         A slang term denoting the presence of
  1404.                          expanded memory that does not place bankable
  1405.                          pages within conventional memory.
  1406.  
  1407. VCPI                     An 80386 memory management standard created
  1408.                          by Phar Lap Software in conjunction with
  1409.                          other software developers.
  1410.  
  1411. VM                       Virtual machine. VM is a protected memory
  1412.                          space created through the hardware capability
  1413.                          of the 386 processor.
  1414.  
  1415. Virtual Memory           A term stating the combination of
  1416.                          conventional, extended, and hard drive factor
  1417.                          memory.
  1418.  
  1419. Virtual Hard Drive       The available space on a hard drive partition
  1420. Memory Factor            that Windows can address as physical memory.
  1421.  
  1422. VMM                      Virtual Memory Manager.
  1423.  
  1424. XMS                      The Microsoft eXtended Memory Specification.
  1425.                          The XMS provides a standard way for real mode
  1426.                          applications to access extended memory. DOS
  1427.                          applications running under Windows 3.00 can
  1428.                          use the XMS to access extended memory. The
  1429.                          XMS document and sample source code is
  1430.                          available from the Microsoft Information
  1431.                          Center at (800) 426-9400 [international
  1432.                          callers should call (206) 882-8661].
  1433.  
  1434.